package com.sixth.volunteerservicesystem.Controller.DonationController.frontDonation;

import com.sixth.volunteerservicesystem.Dao.DonationRepository;
import com.sixth.volunteerservicesystem.domain.DonationProjects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Steve Jobs
 * @create 2020-12-21 13:49
 */
@Controller
public class selectDonation {

    @Autowired
    DonationRepository donationRepository;


    @RequestMapping("selectDonation")
    public String select(Model model){
        List<DonationProjects> donationProjectsList = new ArrayList<>();
        donationProjectsList = donationRepository.findAll();
        model.addAttribute("item", donationProjectsList);

        return "/donation/selectDonation";
    }
}
